package com.Test;

import com.mapper.AccountMapper;
import com.service.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.annotation.Resource;

@ContextConfiguration({"classpath:spring.xml"})
@RunWith(SpringJUnit4ClassRunner.class)
public class SpringTest {
    @Autowired
    AccountMapper accountMapper;
    @Autowired
    UserService userService;
    @Test
    public void selectAll(){
        accountMapper.selectAll();
    }


    @Test
    public void updateSubMoneyById(){
        accountMapper.updateSubMoneyById(1, 100);
    }

    @Test
    public void updateAddMoneyById(){
        accountMapper.updateAddMoneyById(1, 100);
    }
    @Test
    public void transferAccounts(){
        userService.transferAccounts(1, 2, 100);
    }
}